package com.one.react;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.AppCompatButton;
import androidx.appcompat.widget.AppCompatTextView;

import com.one.react.annotation.State;

public class MainActivity extends AppCompatActivity {

    private AppCompatTextView textView;
    private AppCompatButton button;

    @State
    private String text = "Hello";

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        this.textView = findViewById(R.id.main_tv);
        this.button = findViewById(R.id.main_btn);
        textView.setText(text);
        button.setText(text);
        initEvents();
    }

    private void initEvents() {
        button.setOnClickListener(v -> {
            text = "你好";
        });
    }
}
